Skip to content

[codex] Add MCP agent sandbox JWT config#333

Merged
arnold-retool merged 1 commit into
mainfrom
arnold-retool/add-mcp-jwt-key
Jun 12, 2026
Merged

[codex] Add MCP agent sandbox JWT config#333
arnold-retool merged 1 commit into
mainfrom
arnold-retool/add-mcp-jwt-key

Conversation

@arnold-retool

Copy link
Copy Markdown
Contributor

Adds typed MCP configuration for AGENT_SANDBOX_JWT_PRIVATE_KEY, supporting both inline values and Kubernetes Secret references. Documents the new mcp.config keys in both synced values files and adds CI overlays for inline and secret-backed rendering. Bumps the chart patch version to 6.11.2. Validated with Helm render checks, targeted helm lint, a full CI option render sweep, and the values sync diff.

@greptile-apps

greptile-apps Bot commented Jun 12, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds typed MCP configuration support for AGENT_SANDBOX_JWT_PRIVATE_KEY, following the exact same dual-path pattern already established for OAUTH_INTROSPECTION_AUTH_TOKEN — either a Kubernetes secretKeyRef or an inline literal value. The change bumps the chart version to 6.11.2 and adds two CI overlay files to exercise each code path.

  • deployment_mcp.yaml: New if/else if block mirrors lines 139–148 verbatim, placing secret-backed lookup first and the inline literal fallback second; default key name is jwt-private-key consistent with the values.yaml comment.
  • CI overlays: test-mcp-agent-sandbox-secret-option.yaml exercises the secretKeyRef path; test-mcp-enabled-option.yaml adds the inline literal to the existing enabled-option sweep.
  • values.yaml / charts/retool/values.yaml: Both files updated in sync with the new commented-out config keys and inline-vs-secret guidance.

Confidence Score: 5/5

Safe to merge — the change is additive, fully opt-in, and follows the existing pattern for oauthIntrospectionAuthToken without introducing new failure modes.

The new block in deployment_mcp.yaml is a verbatim structural copy of the already-proven oauthIntrospectionAuthToken block, the two CI overlays each cleanly cover one branch, the values files are kept in sync, and the inline-vs-secret guidance in the comments correctly steers operators toward the secret-backed approach for production.

No files require special attention.

Important Files Changed

Filename Overview
charts/retool/templates/deployment_mcp.yaml Adds AGENT_SANDBOX_JWT_PRIVATE_KEY env var injection; new block is structurally identical to the existing oauthIntrospectionAuthToken block at lines 139–148, with a jwt-private-key default key name consistent with the values comments.
charts/retool/ci/test-mcp-agent-sandbox-secret-option.yaml New CI overlay exercising the secretKeyRef code path with a custom key name (private-key); satisfies the required oauthIntrospectionAuthToken guard via the inline token field.
charts/retool/ci/test-mcp-enabled-option.yaml Adds agentSandboxJwtPrivateKey inline literal to the existing enabled-option CI overlay, exercising the else-if branch.
charts/retool/values.yaml Documents the four new config keys in comments; inline literal is clearly marked as dev/testing only; in sync with the root values.yaml.
charts/retool/Chart.yaml Patch version bump from 6.11.1 to 6.11.2, appropriate for the additive config change.
values.yaml Root values.yaml kept in sync with charts/retool/values.yaml; identical diff.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[mcp.config] --> B{agentSandboxJwtPrivateKeySecretName set?}
    B -- Yes --> C[secretKeyRef\nname: SecretName\nkey: SecretKey OR 'jwt-private-key']
    C --> D[AGENT_SANDBOX_JWT_PRIVATE_KEY\nenv var via valueFrom]
    B -- No --> E{agentSandboxJwtPrivateKey set?}
    E -- Yes --> F[Inline literal\nvalue: privateKey]
    F --> G[AGENT_SANDBOX_JWT_PRIVATE_KEY\nenv var via value]
    E -- No --> H[Env var omitted\nno AGENT_SANDBOX_JWT_PRIVATE_KEY]
Loading

Reviews (1): Last reviewed commit: "Add MCP agent sandbox JWT key config" | Re-trigger Greptile

@arnold-retool arnold-retool marked this pull request as ready for review June 12, 2026 23:46

arnold-retool commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Jun 12, 11:56 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 12, 11:56 PM UTC: @arnold-retool merged this pull request with Graphite.

@arnold-retool arnold-retool merged commit 19209fc into main Jun 12, 2026
11 of 13 checks passed
JatinNanda added a commit that referenced this pull request Jun 15, 2026
…gres.urlSecretName); require encryption key (#331)

* fix(rr): stop agentSandbox externalSecret.name from hijacking postgres; require its encryption key

setting rr.agentSandbox.externalSecret.name (intended for the JWT keypair) silently
(a) routed the agent sandbox postgres connection to that secret's postgres-url key
and (b) coupled the encryption key to it. an existing deployment that just wanted to
reuse its backend postgres crashed at runtime with getaddrinfo ENOTFOUND.

- postgres now only reads from externalSecret when postgres.fromExternalSecret: true
  (default false); otherwise it inherits the backend's config.postgresql connection,
  even when externalSecret.name is set for the JWT
- require the agent sandbox encryption key (validateSecrets, mirroring the JWT keys):
  the proxy derives the sandbox-iframe asset-token HMAC key from AGENT_SANDBOX_ENCRYPTION_KEY
  and throws when serving a sandbox without it (agent_executor/proxy/src/config.ts
  getAssetTokenHmacSecret), so 'optional' would surface as a green pod that fails at
  first sandbox use. fail loudly at render instead.
- updated both validateSecrets fail hints to mention postgres.fromExternalSecret: true
- values.yaml (both copies): add postgres.fromExternalSecret, mark encryptionKey required, note 64 hex
- bump chart 6.11.1 -> 6.11.2; update ci fixtures to supply the now-required encryption key
  and add fromExternalSecret: true to the Option-4 sandbox fixture

* Respect postgres.passwordSecretName in presence of rr.agentSandbox.externalSecret

(cherry picked from commit 38304c0)

* refactor(rr): replace postgres.fromExternalSecret with postgres.urlSecretName

the fromExternalSecret boolean was redundant with the existing Option-3
postgres.urlSecretName/urlSecretKey: 'read postgres-url from externalSecret.name'
is identical to pointing urlSecretName at that same secret (urlSecretKey already
defaults to postgres-url). drop the bespoke flag and the externalSecret postgres
branch entirely, so externalSecret.name covers ONLY the JWT/encryption keys and
never sources postgres.

- remove rr.agentSandbox.postgres.fromExternalSecret (both values.yaml copies)
- postgresUrlEnv: delete the externalSecret postgres branch; move the
  passwordSecretName PGPASSWORD support (#332) into the urlSecretName branch, so
  'DSN from a secret + auto-rotated password from another secret' uses Option 3
- validateSecrets: drop the externalSecret term from $explicitPg; repoint both
  fail hints to postgres.urlSecretName
- ci: test-agent-sandbox-enabled-option uses postgres.urlSecretName (Option 3)
  pointed at its JWT secret instead of the removed flag

* fix(rr): render blobStorage env onto the workflow worker

the agentExecutor / snapshotRetention temporal activities run on the
WORKFLOW_TEMPORAL_WORKER (registered in workflowsExecutor/onpremWorker) and read
snapshot blob storage via getBlobStoreForSnapshots (RR_SNAPSHOTS_* with an
RR_DEFAULT_* fallback). but gitServer.commonEnv was only injected onto the main
backend and the standalone git-server pod, so the worker had no RR_DEFAULT_*
and snapshot blob access failed there -- forcing operators to hand-plumb
RR_SNAPSHOTS_* via env.

include gitServer.commonEnv on the worker when rr.gitServer.enabled (no
git-server host/port split -- the worker is a blob-storage client, not the git
server). self-guards on rr.blobStorage being set, so it no-ops otherwise.

* chore(rr): bump chart version to 6.11.3 (rebased past #333)

---------

Co-authored-by: Ryan Artecona <ryanartecona@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants